﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Search</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

    <h2></h2>
    <script src="/Scripts/MicrosoftAjax.js" type="text/javascript"></script>
    <script src="/Scripts/MicrosoftMvcAjax.js" type="text/javascript"></script>
    <script src="/Scripts/MicrosoftMvcValidation.js" type="text/javascript"></script>
    <script src="/Scripts/jquery-1.4.1.js" type="text/javascript"></script>
    <script src="/Scripts/jquery.autocomplete.js" type="text/javascript"></script>
    <link rel="stylesheet" type="text/css" href="/Scripts/jquery.autocomplete.css" />

    <%--<% using (Html.BeginForm()) {%>--%>
    <% using (Ajax.BeginForm("Search", new AjaxOptions {UpdateTargetId = "results"})) { %>

        <%: Html.ValidationSummary(true) %>
        
        <fieldset>
            <legend>Search Reservation</legend>
            
            <span id="InfoMessage" class="field-validation-error">
                <%= TempData["Message"] as string %>
            </span>

            <%= Html.Label("Reservation ID ") %>
            <%= Html.TextBox("query", null, new {size=10}) %>
        
            <input type="submit" value="Search" />

            <br />
            <br />
            <div id="results">
             <% if (Model!=null) Html.RenderPartial("SearchResult", Model); %>
            </div>

        </fieldset>

    <% } %>

    <script type="text/javascript">
        $(document).ready(function () {
            $("#query").autocomplete('<%=Url.Content("~/Reservation/ReservationIdList") %>');
        });
    </script>
</asp:Content>

